package model;

import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

@Entity
@Table(name = "t_sys_module")
public class SysModule implements java.io.Serializable {
	private static final long serialVersionUID = -5242186779502466673L;

	// Fields

	private Integer id;
	private Integer isDisplay;
	private Integer isEnable;
	private String action;
	private String name;
	private Integer orderNumber;
	private String openTarget;
	
	private SysModule parent;
	private Set<SysModule> children;

	@Id
	@GeneratedValue
	@Column(name = "id", nullable = false)
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@Column(name = "is_display")
	public Integer getIsDisplay() {
		return this.isDisplay;
	}

	public void setIsDisplay(Integer isDisplay) {
		this.isDisplay = isDisplay;
	}

	@Column(name = "is_enable")
	public Integer getIsEnable() {
		return this.isEnable;
	}

	public void setIsEnable(Integer isEnable) {
		this.isEnable = isEnable;
	}

	@Column(name = "action", length = 200)
	public String getAction() {
		return this.action;
	}

	public void setAction(String action) {
		this.action = action;
	}

	@Column(name = "name", length = 50)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "order_number")
	public Integer getOrderNumber() {
		return this.orderNumber;
	}

	public void setOrderNumber(Integer order) {
		this.orderNumber = order;
	}

	@Column(name = "open_target", length = 50)
	public String getOpenTarget() {
		return this.openTarget;
	}

	public void setOpenTarget(String openTarget) {
		this.openTarget = openTarget;
	}

	@ManyToOne
	@JoinColumn(name="parent_id")
	public SysModule getParent() {
		return parent;
	}

	@OneToMany(mappedBy="parent")
	public Set<SysModule> getChildren() {
		return children;
	}

	public void setParent(SysModule parent) {
		this.parent = parent;
	}

	public void setChildren(Set<SysModule> children) {
		this.children = children;
	}

}